// ...existing code...

/**
 * Returns a random element from an array.
 * @param {Array} array - The array to sample from.
 * @returns {*} A random element from the array.
 */
function sample(array) {
  if (!Array.isArray(array) || array.length === 0) {
    return undefined;
  }
  const randomIndex = Math.floor(Math.random() * array.length);
  return array[randomIndex];
}

function random(min, max, floating = false) {
  if (floating) {
    return Math.random() * (max - min) + min;
  }
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

// Export the function if needed
export { sample, random };

// ...existing code...

export const wait = (ms) => {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve();
    }, ms);
  });
};

export const getTableData = (tableData) => {
  const data = [];
  for (let i = 0; i < tableData.length; i++) {
    for (let j = 0; j < tableData[i].length; j++) {
      if (tableData[i][j] === 1) {
        data.push([`${j}`, `${i}`]);
      }
    }
  }
  return data;
};
